home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-09-08 | 4.8 KB | 164 lines | [TEXT/CCL2] |
- ;;; -*- package: CC -*-
- ;;;
- ;;;; An extended Apropos dialog
- ;;;
-
-
- (in-package "CC")
-
-
- (defvar *apropos* nil)
-
- (defvar *apropos-width* 500)
- (defvar *apropos-minimum-height* 291)
- (defvar *apropos-symbols-width* 342)
- (defvar *apropos-body-height* 170)
-
- (defvar *apropos-size* (make-point *apropos-width* *apropos-minimum-height*))
- (defvar *apropos-position* :centered)
-
-
- (defvar *working* nil)
-
- (defvar *search-domain* :global)
- (defvar *update-frequency* 25)
-
- (defvar *show-p* nil)
- (defvar *show-what* :value)
-
- (defvar *default-package*
- ;; Set this to NIL to get "all packages".
- (find-package "CL-USER"))
-
- (defvar *auto-search*
- ;; If set to T, selecting a pop up menu
- ;; will automatically do a search. Use the
- ;; option key to toggle the behavior.
- t)
-
-
- (defclass extended-apropos (apropos-hide-window)
- ()
- (:default-initargs
- :window-title "Apropos"
- :window-type :document-with-grow
- :view-size *apropos-size*
- :view-position *apropos-position*
- :view-subviews
- (list
- (make-instance 'help-button :view-position #@(477 6))
- (make-instance 'apropos-title :view-position #@( 5 5))
- (make-instance 'name-subview :view-position #@( 15 28))
- (make-instance 'criterion-subview :view-position #@( 15 55))
- (make-instance 'package-subview :view-position #@( 5 106))
- (make-instance 'heritage-subview :view-position #@( 5 134))
- (make-instance 'search-subview :view-position #@(290 104))
- (make-instance 'search-thermometer :view-position #@(482 181))
- (make-instance 'action-subview :view-position #@(353 176))
- (make-instance 'symbols-table :view-position #@( 0 170)
- :view-size (make-point *apropos-symbols-width*
- (- (point-v *apropos-size*)
- *apropos-body-height*))))))
-
-
- (defmethod help-string ((self extended-apropos))
- (format nil "Use this window to search for symbols matching ~
- certain specific criteria.~%~%~
- Note: this window can be resized, don't be fooled ~
- by the fact that the grow icon is not drawn.~%~%~
- Note: you can use the copy menu item to copy the ~
- selected symbol's name to the clipboard."))
-
-
- (defmethod view-cursor ((self extended-apropos) point)
- (declare (ignore point))
- (if *working*
- *watch-cursor*
- (call-next-method)))
-
-
- (defmethod view-draw-contents :after ((self extended-apropos))
- (#_MoveTo 4 90) (#_LineTo 495 90)
- (#_MoveTo 347 169) (#_LineTo 495 169)
- (#_MoveTo 273 95) (#_LineTo 273 164))
-
-
- (defmethod window-draw-grow-icon ((self extended-apropos))
- )
-
-
- (defmethod window-grow-rect ((self extended-apropos))
- (make-record :rect
- :left (+ *apropos-width* 1) :top *apropos-minimum-height*
- :right (+ *apropos-width* 1) :bottom 20000))
-
-
- (defmethod set-view-size :after ((self extended-apropos) h &optional v)
- (when (null v)
- (setf v (point-v h)
- h (point-h h)))
- (set-view-size (apropos-view 'symbols-table)
- *apropos-symbols-width* (- v *apropos-body-height*)))
-
-
- (defmethod view-key-event-handler ((self extended-apropos) char)
- (if (or (eql char #\UpArrow)
- (eql char #\DownArrow))
- (let ((table (apropos-view 'symbols-table)))
- (let ((cell (first (selected-cells table))))
- (when cell
- (let ((next (case char
- (#\UpArrow (- (point-v cell) 1))
- (#\DownArrow (+ (point-v cell) 1)))))
- (when (and (>= next 0)
- (< next (point-v (table-dimensions table))))
- (cell-deselect table 0 (point-v cell))
- (cell-select table 0 next)
- (when (null (cell-position table 0 next))
- (scroll-to-cell table 0 next)))))
- (able-action-buttons)))
- (call-next-method)))
-
-
- (defun make-or-show-extended-apropos ()
- (cond ((or (null *apropos*)
- (null (wptr *apropos*)))
- (setf *search-domain* :global)
- (setf *show-p* nil *show-what* :value)
- (setf *apropos* (make-instance 'extended-apropos)))
- (t
- (reinstall-package-menu)
- (window-select *apropos*)))
- (select-all (apropos-view 'name-text)))
-
-
- (defmethod copy ((self extended-apropos))
- (put-scrap :text (string-downcase (symbol-name (selected-symbol)))))
-
-
- (defun apropos-view (name)
- (find-view *apropos*
- name))
-
-
- ;;;
- ;;;; Installing the Extended Apropos
- ;;;
-
-
- (set-menu-item-action-function (find-menu-item (find-menu "Tools")
- "Apropos")
- 'make-or-show-extended-apropos)
-
-
- ;;;
- ;;;; Cleaning Up
- ;;;
-
-
- (defun forget-extended-apropos ()
- (setq *apropos* nil))
-
- (push 'forget-extended-apropos
- *save-exit-functions*)
-